﻿using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using weikebuluo.DAL;
using weikebuluo.Model;
using weikebuluo.Common;

namespace weikeweixin.web.admin.order
{
    public partial class foodlist : weikeweixin.web.admin.cs.adminbase
    {
        a_foodlist_dal foodlistdal = new a_foodlist_dal();
        JsonOperate JsonOperate = new JsonOperate();
        protected void Page_Load(object sender, EventArgs e)
        {
            switch (Request.QueryString["action"])
            {
                case "list":
                    list();
                    break;
                case "del":
                    del();
                    break;
            }

        }

        /// <summary>
        ///查询
        /// </summary>
        public void list()
        {
            string where = "store_id=" + user_id;
            int Page = int.Parse(Request.Form["page"]);
            int RecordCount = foodlistdal.GetRecordCount(where);
            DataTable dtfoodlist = foodlistdal.GetListByPage1(where, "foodlist_sort", ((Page - 1) * 10) + 1, (Page - 1) * 10 + 10).Tables[0];
            Response.Write(JsonOperate.GetDataGridJson(dtfoodlist, RecordCount));
            Response.End();
        }

        /// <summary>
        /// 删除添加的门店
        /// </summary>
        public void del()
        {
            bool bl = foodlistdal.Delete(int.Parse(Request.QueryString["Id"].Trim()));
        }
    }
}
